package com.sctvcloud.dongqu.ui.adapter.holder;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ruihang.generalibrary.ui.adapter.holder.BaseRecylerHolder;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.sctvcloud.dongqu.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class HomeAnchorEntranceHolder extends BaseAbsHolder {
    @BindView(R.id.anchor_layout)
    protected RelativeLayout anchorLayout;
    @BindView(R.id.radio_layout)
    protected RelativeLayout radioLayout;
    @BindView(R.id.goods_layout)
    protected RelativeLayout goodsLayout;
    @BindView(R.id.title_anchor)
    protected TextView titleAnchor;
    @BindView(R.id.title_radio)
    protected TextView titleRadio;
    @BindView(R.id.title_goods)
    protected TextView titleGoods;

    private OnEntranceClickListener listener;

    public HomeAnchorEntranceHolder(Context context, View itemView, OnEntranceClickListener listener ) {
        super(context, itemView);
        this.listener = listener;
    }
    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(Object o) {
        titleAnchor.getPaint().setFakeBoldText(true);
        titleRadio.getPaint().setFakeBoldText(true);
        titleGoods.getPaint().setFakeBoldText(true);
        anchorLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(null!=listener){
                    listener.onEntranceClick(1);
                }
            }
        });
        radioLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(null!=listener){
                    listener.onEntranceClick(2);
                }
            }
        });
        goodsLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(null!=listener){
                    listener.onEntranceClick(3);
                }
            }
        });
    }

    public interface OnEntranceClickListener {
        void onEntranceClick(int clickType);
    }
}
